package com.dsl.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;

import java.util.Date;

/**
 * @Description 帖子实体类
 * @Author dsl
 * @Date 2024/8/31 上午10:33
 * @Version 1.0
 */

@Data
@Document(indexName = "discusspost")
@Setting(shards = 6, replicas = 3)
@JsonIgnoreProperties(ignoreUnknown=true)
public class DiscussPost {

    @Id
    private int id;

    @Field(type = FieldType.Integer)
    private int userId;

    //分词器拆分关键词，帖子标题
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String title;

    //分词器拆分关键词，帖子内容
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String content;

    //帖子类型，0-普通; 1-置顶;
    @Field(type = FieldType.Integer)
    private int type;

    //帖子状态，0-正常; 1-精华; 2-拉黑;
    @Field(type = FieldType.Integer)
    private int status;

    //创建时间
    @Field(type = FieldType.Date)
    private Date createTime;

    //评论数量
    @Field(type = FieldType.Integer)
    private int commentCount;

    //热度得分
    @Field(type = FieldType.Double)
    private double score;

}
